package com.wuxiaofan.product.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.product.entity.AttrAttrgroupRelation;
import com.wuxiaofan.product.entity.custom.AttrAttrgroupRelationCustom;
import com.wuxiaofan.product.mapper.AttrAttrgroupRelationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.product.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class AttrAttrgroupRelationService {
    @Autowired
    private AttrAttrgroupRelationMapper pmsAttrAttrgroupRelationMapper;
    @Resource
    private Idgenerator idgenerator;
    public AttrAttrgroupRelation findById(String id){
        return pmsAttrAttrgroupRelationMapper.selectById(id);
    }

    public AttrAttrgroupRelationCustom findCountByMap(Map paraMap){
        return pmsAttrAttrgroupRelationMapper.findCountByMap(paraMap);
    }

    public AttrAttrgroupRelationCustom findGroupByMap(Map paraMap){
        return pmsAttrAttrgroupRelationMapper.findGroupByMap(paraMap);
    }

    public List<AttrAttrgroupRelationCustom> findByMap(Map paraMap){
        return pmsAttrAttrgroupRelationMapper.findByMap(paraMap);
    }

    public Page<AttrAttrgroupRelationCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(pmsAttrAttrgroupRelationMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        pmsAttrAttrgroupRelationMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        pmsAttrAttrgroupRelationMapper.deleteById(id);
    }

    public AttrAttrgroupRelation save(AttrAttrgroupRelation pmsAttrAttrgroupRelation){
        pmsAttrAttrgroupRelation.setId(idgenerator.getId());
        pmsAttrAttrgroupRelationMapper.insert(pmsAttrAttrgroupRelation);
        return pmsAttrAttrgroupRelation;
    }

}
